package com.ljt.kotlinandmvvm.login

import android.content.Intent
import android.text.TextUtils
import android.view.View
import com.ljt.base.activity.BaseActivity
import com.ljt.kotlinandmvvm.R
import com.ljt.kotlinandmvvm.databinding.ActivityLoginBinding
import com.ljt.kotlinandmvvm.register.RegisterActivity
import kotlinx.android.synthetic.main.draw_module_title.view.*

/**
 * @auther :lujiantao
 * @date :2024/5/4 2:38 PM
 * @desc :登录
 */
class LoginActivity:BaseActivity<ActivityLoginBinding, LoginViewModule>(), View.OnClickListener {
    override fun getLayoutResId(): Int {
        return R.layout.activity_login
    }

    override fun createViewModel(): LoginViewModule {
        return LoginViewModule()
    }

    override fun initView() {
        binding.ilModuleTitle.tvModuleTitle.text = "登录"
        binding.ilModuleTitle.ivModuleBack.setOnClickListener(this)
        binding.tvModuleRegister.setOnClickListener(this)
        binding.tvModuleLogin.setOnClickListener(this)
    }

    override fun initData() {

    }

    override fun onClick(v: View?) {
        var id = v?.id
        if (id == R.id.ivModuleBack){
            finish()
        }else if(id == R.id.tvModuleRegister){
            startActivity(Intent(this, RegisterActivity::class.java))
        }else if (id == R.id.tvModuleLogin){
            var account:String = binding.etModuleAccount.text.trim().toString()
            var pwd:String = binding.etModulePwd.text.trim().toString()
            if (!TextUtils.isEmpty(account) && !TextUtils.isEmpty(pwd)){

            }
        }
    }
}